package com.inspectortime.webapp.util;

import java.util.Comparator;

import com.inspectortime.domain.util.InspectionDateComparator;
import com.inspectortime.domain.util.InspectionInspectorComparator;

/**
 * For sorting lists of inspections in the Inspection Central area.  
 * First compares by Inspector Name.  On name matches, compares by inspection date/time
 * 
 * @author bones
 *
 */
public class InspectionListNameDateComparator implements Comparator {
	
	public int compare(Object arg1, Object arg2) {
		int result = new InspectionInspectorComparator().compare(arg1, arg2);
		
		if (result != 0) {
			return result;
		}
		
		return new InspectionDateComparator().compare(arg1, arg2);
	}

}
